let parser = new DOMParser();
let OFPXML = parser.parseFromString(json, "application/xml");
Formats = OFPXML.querySelector('Formats');
XML1 = Formats.children[1].innerHTML;
console.log(XML1); // This retains linebreaks
document.getElementById('text_from_XML_node_here').innerHTML = XML1; // This does not retain them.
Console.log shows the text with linebreaks but the DOM element removed them all.
This is a low-priority question as I am just learning and experimenting with things.
The line breaks are not shown in the rendered HTML element. When DOM elements are rendered, raw newlines like \n are ignored. If you want line breaks explicitly to show, you have the following options:
<pre><br />